<?php
//和ajax_load.html配套(获取数据)
$init = $_POST["init"];
$start = ($init-1)*5;
$pdo = new PDO("mysql:host=127.0.0.1;dbname=news","root","keyan");
$pdo->exec("set names utf8");
$sql = "select articleId,title from newsarticles limit $start,5 ";
$pdos= $pdo->query($sql);
$arr = $pdos->fetchAll(PDO::FETCH_ASSOC);
//将数组转化为json串
echo json_encode($arr);
//json_decode($json);//这是将json串转回数组